const common = require("../../../../common/common")
const AJAX = require("../../../../common/request")
const API = require("../../../../common/api")
const App = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navTop: 0,
    navContentHeight: 0,
    placeholderHeight: 0,
    scrollHeight:0,
    adHeight:0,
    UPLOADURL: "",
    options: {},
  },

  /**
   * 生命周期函数--监听页面加载
   */
  async onLoad(options) {
    this.setData({
      navTop: App.globalData.navTop,
      navContentHeight: App.globalData.navContentHeight,
      UPLOADURL: API.UPLOADURL,
    })
    const query = wx.createSelectorQuery();
    query.select('.head').boundingClientRect();
    await query.exec((res) => {
      console.log(res)
      this.setData({
        placeholderHeight: res[0].height,
        scrollHeight: App.globalData.windowHeight - this.data.navTop - this.data.adHeight - res[0].height - 10
      })
    });
    AJAX.POST("/system/AppWechat/getbSkinDisease", {
      id: options.id
    }).then(res => {
      console.log(res.rows[0])
      this.setData({
        options: res.rows[0]
      })
    })
  },

  goBack() {
    const pages = getCurrentPages();
    //获取不到上级返回首页
    if (pages.length > 1) {
      wx.navigateBack({})
    } else {
      wx.reLaunch({
        url: '/pages/index/index',
      })
    }
  },
  onShareAppMessage(options) {
    // 默认分享配置
    return {
        title: App.globalData.onShareAppMessage.title,
        path: App.globalData.onShareAppMessage.path,
        imageUrl: App.globalData.onShareAppMessage.imageUrl,
    }
},
})